package com.bw.user.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName LoginWebConfig
 * @Author Hao_YunKai
 * @Date 2022/3/25 20:28
 */
@Configuration
public class LoginWebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")  // 拦截所有
                .excludePathPatterns(
                        "/login","/",  // 跳转登录
                        "/user_register","/", // 跳转登录
                        "/user/house-user/register",  // 注册
                        "/user/house-user/login",  // 登录
                        "/user/house-user/upload",  // 头像上传
                        "/user/house-user/sendMsg/**",  // 发送验证码
                        "/static/**");  // 静态资源
    }
}
